<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>Basic DataGrid - jQuery EasyUI Demo</title>
		<link rel="stylesheet" type="text/css" href="../../../../js/lib/jquery-easyui-v1.5.1/themes/default/easyui.css">
		<link rel="stylesheet" type="text/css" href="../../../../js/lib/jquery-easyui-v1.5.1/themes/icon.css">
		<link rel="stylesheet" type="text/css" href="../../demo.css">
		<script type="text/javascript" src="../../../../js/lib/jquery-easyui-v1.5.1/jquery.min.js"></script>
		<script type="text/javascript" src="../../../../js/lib/jquery-easyui-v1.5.1/jquery.easyui.min.js"></script>
	</head>

	<body>
		<h2>Basic DataGrid</h2>
		<p>The DataGrid is created from markup, no JavaScript code needed.</p>
		<div style="margin:20px 0;"></div>

		<table id="dg" style="width:700px;height:250px" </table>
			<script type="text/javascript">
				$("#dg").datagrid({
					columns: [
						[{
								field: 'name',
								title: '姓名'
							}, {
								field: '#action',
								title: '行为',
								formatter: function(value, row, index) {
									return "<button data-action='add' onclick='add()'>添加</button><button data-action='edit'>编辑</button>"
								}
							}

						]
					],
					data: [{
						name: 'S1'
					}, {
						name: 'S2'
					}],
					onClickCell:function(index, field, value) {
						debugger;
//						var action = window.event.target.dataset.action;
//						alert(action);
					}
				})
			</script>
	</body>

</html>